#include "Cursor.h"
#include "SFML/Graphics.hpp"
#include "ResourceDatabase.h"

Cursor* Cursor::pInstance = new Cursor();

Cursor* Cursor::get()
{
    return pInstance;
}

Cursor::Cursor()
{

}

void Cursor::init(sf::RenderWindow* window)
{
    this->window = window;
    this->window->ShowMouseCursor(false);
    
    this->sprite = sprite;

    sprite = AnimatedSpritePtr(new AnimatedSprite(IMG_CURSOR_DEFAULT));
}

void Cursor::update()
{
    const sf::Input& i = window->GetInput();
    sprite->SetPosition
        (i.GetMouseX() - 7 + window->GetView().GetCenter().x - window->GetView().GetSize().x / 2
        ,i.GetMouseY() - 7 + window->GetView().GetCenter().y - window->GetView().GetSize().y / 2);
    window->Draw(*sprite);
}

void Cursor::show()
{
}

void Cursor::hide()
{
}

void Cursor::setCursor()
{
}